package object2;

/**
 * 面向对象编程(中级部分)练习
 */
public class Object2Exercise06 {

    public static void main(String[] args) {

        new Demo().test();//Tests Demo Rose Jack
        new Demo("john").test();//john jack
    }
}

class Tests {

    String name = "Rose";

    Tests() {
        System.out.println("Tests");
    }

    Tests(String name) {
        this.name = name;
    }
}

class Demo extends Tests {

    String name = "Jack";

    Demo() {
        super();
        System.out.println("Demo");
    }

    Demo(String s) {
        super(s);
    }

    public void test() {
        System.out.println(super.name);
        System.out.println(this.name);
    }
}
